<script>
	$("#filtre").bigoFilter("#items");
	$(document).ready(function() {
	$(".numeric").numeric();
    $('#update').val('default');   
    $('#items').change(function() {
		var html = "<img src=<?php echo $this->webroot.IMAGES_URL;?>/items/"+$(this).find("option:selected").attr("title")+">";
         $('#preview').html(html);
    });
});
</script>
<div class="titlepanel"><?php __('Give item');?></div>
<div class="ui-widget-content contentpanel" style="padding:10px">
<div style="width:220px;margin:auto">
<?php
echo $form->create(null,array('id'=>'giveitemform'));
echo $form->input('filter',array('div'=>false,'label'=>__('Filter :',true),'id'=>'filtre'));
?>
<select name="data[items]" id="items" style="width:180px">
<option value=""> - <?php __('Select Item');?> - </option>
<?php
foreach($listitems as $listitem)
{
	echo "<option value='".$listitem['item']['id']."' title='".$listitem['item']['image']."'>".$listitem['item']['name']."</option>";
}
?>
</select>
<div id="preview" style="float:right"></div>
<?php
echo $form->input('amount',array('class'=>'numeric','id'=>'amount','div'=>false,'label'=>__('Amount :',true)));
echo $form->end();
?>
<br/>
<center>
<button id="addinvitem" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" role="button" aria-disabled="false"><span class="ui-button-text"><?php __('Give to player');?></span></button></center>

<?php
$this->Js->get('#addinvitem');
$this->Js->event('click',
$this->Js->request(
array('controller' => 'private','action'=>'invadd'),
array(
'type'=>'json',
'method'=>'post',
'update' => '#player_inventory',
'data'=> '{player:player,block_type:$("#items").val(),amount:$("#amount").val()}',
'dataExpression' => true,
'complete' => '$.unblockUI();',
'success'=>'$.blockUI({ message:"<h1>'.__('Send succeed...',true).'</h1>"});',
'error'=>'alert("'.__('An unexpected error has occurred!',true).'");'							
	)));

echo $this->Js->writeBuffer();
?>
</div>
</div>